package org.kb;

import org.dream.util.DoubleUtil;
import org.dream.util.LogFactory;

public class PerformanceTest {
	public static void testDouble() {
		LogFactory.getLog().startLogTime("testDouble");
		for (int i = 0; i < 1000000; i++) {
			double a = 2d + 3d;
		}
		LogFactory.getLog().endLongTime("testDouble");

	}

	public static void testDoubleUtilAdd() {
		LogFactory.getLog().startLogTime("testDoubleUtilAdd");
		for (int i = 0; i < 1000000; i++) {
			DoubleUtil.add(2d, 3d);
		}
		LogFactory.getLog().endLongTime("testDoubleUtilAdd");

	}

	public static void testDoubleUtilChangeDecimal() {
		LogFactory.getLog().startLogTime("testDoubleUtilChangeDecimal");
		for (int i = 0; i < 1000000; i++) {
			DoubleUtil.changeDecimal(3.4444444444444466d, 6);
		}
		LogFactory.getLog().endLongTime("testDoubleUtilChangeDecimal");

	}

	public static void testParseDouble() {
		LogFactory.getLog().startLogTime("testParseDouble");
		for (int i = 0; i < 1000000; i++) {
			Double.parseDouble("3.4444444444444466d");
		}
		LogFactory.getLog().endLongTime("testParseDouble");

	}

	public static void main(String[] args) {

		testDouble();
		testDoubleUtilAdd();
		testDoubleUtilChangeDecimal();
		testParseDouble();
	}

}
